import QtQuick

/*
  自定义组件：带边框的标题包围框
*/
Rectangle {
    id: customBorderTitle
    width: 200
    height: 100
    border.width: 1
    border.color: "#888888"

    property string cbtTitle: qsTr("title") // 标题文本
    property color cbtTitleBackColor: "transparent" // 标题背景颜色
    property color cbtTitleColor: "#000000" // 标题文本颜色
    property int cbtFontSize: 14 // 标题字体大小
    property real cbtTitleX: 10 // 标题x轴偏移

    Rectangle {
        id: titleRect
        x: cbtTitleX
        y: - height / 2
        width: titleText.width + 4
        height: titleText.height + 4
        color: cbtTitleBackColor
        radius: 4

        Text {
            id: titleText
            x: 2
            y: 2
            text: cbtTitle
            color: cbtTitleColor
            font.pixelSize: cbtFontSize
            font.italic: true
        }
    }
}
